<template>
  <div>
    <Header></Header>
    <div class="block" v-loading="loading">
      <el-timeline v-for="item in blogList">
        <el-timeline-item :timestamp="item.created.substring(0,10)" placement="top">
          <el-card>
            <h4>{{ item.title }}</h4>
            <p>{{ item.description }}</p>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
</template>

<script>
import Header from "../components/Header";
import {blogList} from "../api/blog";

export default {
  name: "Blogs",
  created() {
    this.$http.get("http://localhost:8081/blog/list").then(res => {
      this.blogList = res.data.data.records
      this.loading = false
      // console.log(res.data.data)
    })
  },
  data() {
    return {
      blogList: [],
      loading: true
    }
  },
  components: {
    Header
  }
}
</script>

<style scoped>
.block {
  width: 80%;
  padding-left: 10%;
}
</style>